Apparatus and method for recognizing and determining the position of a part of an animal

ABSTRACT

The present invention relates to an apparatus and a method for recognizing and determining the position of a part of an animal. The apparatus comprises a source of structured light for illuminating a region expected to contain at least one part in such a way that an object illuminated by the light simultaneously or discrete in time is partitioned into at least two illuminated areas, where each two illuminated areas are separated by a not illuminated area, an image capture device arranged to capture at least one image formed by the light and provide an image signal, the apparatus further comprising image signal processing device to respond to the captured image signal and a control device to determine if the illuminated object is the part by comparing the image of the illuminated object to reference criteria defining different objects, and if the illuminated object is established to be the part of the animal, the position thereof is established, an animal related device and the device to guide the animal related device towards to the position of the part.

TECHNICAL FIELD OF THE INVENTION

The present invention relates to an apparatus for recognising anddetermining the position of a part of an animal. The present inventionalso relates to a method for recognising and determining the position ofa part of an animal.

DESCRIPTION OF RELATED ART

Over some twenty to thirty years numerous proposals have been made fortechniques by which a milking apparatus, defined as including a teat cupconnected to a milking machine, a teat cleaning device and a teatexamination device, can be applied to a teat of a milk animal, such as acow, by automatic means so as to avoid the need for attendance by anoperator during the procedure of milking an animal.

As automatic techniques for the rest of the milking procedure have beenavailable for some time, automation of the teat-cup application stagehas become the main obstacle to the development of a fully-automaticmilking procedure which does not require continuous attendance andenables the so-called “milking on demand” regime.

For many reasons, e.g. animal safety and comfort, milk hygiene andeconomic efficiency, the application stage has to be extremely reliable.That is a teat-cup must be quickly and correctly applied to a teat onevery occasion when an animal presents for milking. Also, the equipmentfor carry out the application stage has to work in difficult conditionsand must to be durable while not being too expensive.

EP-A-306 579 discloses a combination of a general sensor and localsensor to guide a teat cup onto a teat. The general sensor is mountedalongside the stall and projects a sheet of light derived from a lasertowards the region where the udder and teats of an animal in the stallfor milking will be present. The sheet of light is incident on an udderand teats when present and produces lines of light on the udder andteats. The sheet of light can be swept through the region to anappropriate position. A camera is mounted as part of the sensor andforms an image of the lines. The image includes discontinuous lines forthe teats where illuminated by the sheet of light. These lines areanalysed in a control arrangement so as to find the position of theteat(s) and calculate coordinates by triangulation for two horizontalaxis and vertical axis. Reference values for the coordinates stored inthe control arrangement assist in analysis by limiting the search andcalculating time. The calculated coordinates are used to bring the localsensors in range of a teat. Knowledge of the reference coordinates maybe used to limit the image analysis to the part of the image where theteats are expected to be found, thereby reducing the calculation time.

EP-A2-647 393 discloses an implement for milking an animal, such as acow. The implement includes a robot arm able to carry teat cups, a lasertransmitter element and a receiver element. The receiver elementincludes a diode detector, which supplies a signal determined by threeparameters: the distance d from the sensor means to the object, and theangles α₁ and α₂ which indicate the initial angle and the final angle,respectively, of the laser beam moving across the object. This implementmakes use of a conventional animal recognition data source foridentifying the animal when it arrives in the milking parlour. Theanimal recognition is of importance to this implement to the extent thatthereby is known for each animal the position of the teats of theanimal's udder relative to a fixed point on the animal.

The first disclosure (EP-A 306 579) has the disadvantage that twosensors are needed and that one has to be mounted alongside the stall inan exposed position.

The disclosures mentioned above all require the use of what is calledhistorical data about the animals, i.e. where the teats are positionedon the udder at a previous milking session. They also require the use ofstalls for the animals to be placed in.

SUMMARY OF THE INVENTION

It is an object of the invention to provide an improved teat locationtechnique for automatic milking procedures.

According to the invention there is provided an apparatus forrecognising and determining the position of at least one part of ananimal. The apparatus comprises a source of structured light forilluminating a region expected to contain said at least one part in sucha way that an object illuminated by said light simultaneously ordiscrete in time is partitioned into at least two illuminated areas,where each two illuminated areas are separated by a not illuminatedarea. The apparatus also comprises an image capture means arranged tocapture at least one image formed by said light and provide an imagesignal, an image signal processing means to respond to said capturedimage signals and a control means to determine if the illuminated objectis said part by comparing the image of the illuminated object toreference criteria defining different objects, and if said illuminatedobject is established to be said part of the animal, the positionthereof is established. The apparatus further comprises an animalrelated device and means to guide the animal related device towards thedetermined position of said part. The main advantage with the apparatusaccording to the present invention is that it does not require the useof what is called historical data about the animals. The animals do notneed to be placed in special stalls, i.e. they can walk aroundunobstructedly. Another advantage is that it is easy to distinguishbetween different parts of an animal.

Advantageously the source of structured light is a light emittingdevice, and each area of said at least two illuminated areas is in theform of a line or a dot and the number of lines or dots is such that thecontrol means is allowed to identify the illuminated object. Hereby isachieved that the illuminated object will be easily identified.

According to another embodiment of the apparatus according to thepresent invention, the source of structured light is at least two lightemitting devices, wherein each light emitting device gives rise to alight emitting beam, wherein each two consecutive light emitting beamsare separated by an angle α, and in that each area of said at least twoilluminated areas is in the form of a line or a dot and the number oflines or dots is such that the control means is allowed to identify theilluminated object.

According to yet another embodiment of the apparatus according to thepresent invention, the source of structured light is at least two lightemitting devices, wherein each light emitting device gives rise to alight emitting plane, wherein each two consecutive light emitting planesin a vertical plane are separated by an angle α, and in that each areaof said at least two illuminated areas is in the form of a line and thenumber of lines is such that the control means is allowed to identifythe illuminated object.

Preferably, in a vertical plane, the lowermost light emitting beam orlight emitting plane is positioned to pass a small distance d above thecentre of the mouth of a supported teat cup.

Advantageously the number of light emitting beams or light emittingplanes are two, and said angle, α, is preferably 8° and said distance dis preferably 8.5 mm.

Preferably, the apparatus also comprises a support means provided forscanning movement of the light emitting beam.

According to a first embodiment of the apparatus according to thepresent invention, the light emitting beam performs a scanning movementin a substantially horizontal plane by means of said support means.

According to a second embodiment of the apparatus according to thepresent invention, the light emitting beam performs a scanning movementin a substantially vertical plane by means of said support means.

According to a third embodiment of the apparatus according to thepresent invention, the light emitting beam performs a scanning movementin a substantially inclining plane by means of said support means.

According to a fourth embodiment of the apparatus according to thepresent invention, the support means is moved mainly in a zigzagpattern.

The scanning plane(s) or the light emitting planes is/are moved stepwisein such a way that a distance between two consecutive scanning planes orlight emitting planes is greater than the width of the light emittingbeam. Hereby, the providing of lines is achieved.

Preferably, the image signals obtained form different scanning planes orlight emitting planes when illuminating an object gives rise to parallellines in the complete image.

Advantageously the image signals obtained form different scanning planesor light emitting planes when illuminating an object gives rise todivergent lines in the complete image.

According to a third embodiment of the apparatus according to thepresent invention, the apparatus also comprises a screen with slits or araster arranged in front of the light emitting device. Hereby lines areprovided without moving parts, i.e. without scanning movement.

Preferably, the image signals obtained from the screen with slits or theraster when illuminating an object gives rise to a plurality of lines ordivergent lines or a plurality of inclining lines in the image.

Advantageously, in another embodiment of the apparatus according to thepresent invention, the apparatus also comprises a screen, with aplurality of through holes arranged in a predetermined pattern, arrangedin front of the light emitting device. Hereby, the provision of dots isachieved.

Preferably, the image signals obtained from the screen with throughholes arranged in a predetermined pattern, when illuminating an objectgives rise to a plurality of dots arranged in the image.

Preferably the image processing means process the different imagesignals to distinguish between relevant and not relevant lines or dots,whereby a relevant line is defined as a line with a length between 2 cmand 7 cm, and relevant dots are defined as dots arranged on an imaginaryline with a length between 2 cm and 7 cm, to provided a complete imageof illuminated objects, wherein the complete image is used by thecontrol means for comparing the complete image to reference criteriadefining different objects. The apparatus also comprises a filteringmeans to filter the image signals and eliminate not relevant lines ordots. Hereby, better quality in recognising and determining the positionof a part of an animal is achieved.

Advantageously, the control means groups together said lines or dotsinto different groups in dependence of the position in a plane for eachline or dot, and the length in said plane for each line or dots in saidplane.

Preferably, the control means calculates a position for each group,which position is the mean value of the positions for each line or dotin said group, where each group represents an object. Hereby, therecognising and determining the position of the part searched for of ananimal is achieved with better quality even if the animal is moving.

Preferably, the support means is moved in correspondence with themovement of said position for a group.

Advantageously, the animal related device is one of a teat milking cup,a teat cleaning device and a teat inspection device and the part is ateat of a milk animal.

The part can also be a rump of a milk animal.

The source of structured light is positioned to pass no lower than themouth of a supported teat cup and the image capture means is a videocamera arranged to view through the structured light and over the mouthof the cup.

Preferably, the video camera is a camera of the CCD type (ChargedCoupled Device).

Advantageously, the image processing means includes means to select fromthe captured image signals a part including possible teat image signalsand process only the selected part, thereby reducing the time betweensuccessive processings of the teat image signals.

Preferably, the image signal processing means provides in said capturedimage signals the position of a teat cup entry point for a selectedteat.

Advantageously, the image signal processing means includes means toquantify the spatial separation represented by the selected partincluding possible teat image signals and the teat cup entry pointsignal and provide appropriate control information for said guide means.

Preferably, the control information causes more rapid movement of theguide means the greater said spatial separation. Hereby is achieved thatthe apparatus according to the present invention is working faster.

Advantageously, the support means comprises a robot arm and at least onelight emitting device arranged on the robot arm.

According to another embodiment the support means comprises a robot arm,at least one light emitting device arranged on the robot arm, and apivotal means by means of which the light emitting beam(s) performs ascanning movement.

Preferably, the number of lines are two.

Advantageously, the light emitting device is a laser emitting device.

According to another embodiment the light emitting device is an infraredlight emitting device.

According to a further embodiment the light emitting device is a lampand the apparatus also comprises a lens/lenses to diffract the lightfrom the lamp.

According to yet a further embodiment each light emitting device is alaser emitting device and the apparatus also comprises a lens/lenses todiffract the laser emitting beam from each laser emitting device to alaser emitting plane, wherein the lowermost laser emitting plane is usedto determine the position of the tip of said part.

Another object of the invention is to provide a method for recognisingand determining the position of at least one part of an animal. Themethod comprises the following steps:

illuminating with structured light a region expected to contain said atleast one part in such a way that an object illuminated by said lightsimultaneously or discrete in time is partitioned into at least twoilluminated areas, where each two illuminated areas are separated by anot illuminated area,

capturing at least one image formed by said light and provide an imagesignal,

processing said image signals to determine if the illuminated object issaid part by comparing the image of the illuminated object to referencecriteria defining different objects, and if said illuminated object isestablished to be said part of the animal, the position thereof isestablished, and

providing information for guiding an animal related device towards thedetermined position of said part. The main advantage with the methodaccording to the present invention is that it does not require the useof what is called historical data about the animals. The animals do notneed to be placed in special stalls, i.e. they can walk aroundunobstructedly. Another advantage is that it is easy to distinguishbetween different parts of an animal.

Advantageously, the method comprises the steps:

illuminating said object with a light emitting beam, wherein each areaof said at least two illuminated areas is in the form of a line or adot, and

wherein the number of lines or dots is such that it allows foridentifying the illuminated object. Hereby is achieved that theilluminated object will be easily identified.

According to another embodiment of the method according to the presentinvention, the method comprises the step:

illuminating said object with at least two light emitting beams, whereineach two consecutive light emitting beams in a vertical plane areseparated by an angle α, wherein each of said at least two illuminatedareas is in the form of a line or a dot, and

where the number of lines or dots is such that it allows for identifyingthe illuminated object.

According to yet another embodiment of the method according to thepresent invention, the method comprises the step:

illuminating said object with at least two light emitting planes,wherein each two consecutive light emitting planes in a vertical planeare separated by an angle α, wherein each of said at least twoilluminated areas is in the form of a line, and

where the number of lines is such that it allows for identifying theilluminated object.

Preferably, the method also comprises the step:

passing a small distance d above the centre of the mouth of a supportedteat cup with the lowermost, in a vertical plane, light emitting beam orlight emitting plane.

Advantageously, the number of light emitting beams or light emittingplanes are two.

Preferably, the method also comprises the step:

moving the light emitting beam to perform a movement mainly in a zigzagpattern.

Advantageously, the method also comprises the steps:

pivoting the light emitting beam to perform a scanning movement in asubstantially horizontal plane, and

during scanning moving the scanning plane upwardly from a position belowthe part to a position wherein the position of the part can bedetermined.

According to another embodiment of the method according to the presentinvention, the method comprises the step:

pivoting the light emitting beam to perform a scanning movement in asubstantially vertical plane. The method also comprises the step:

moving the scanning plane(s) or light emitting planes step-wise in sucha way that a distance between consecutive scanning planes or lightemitting planes is greater than the width of the light emitting beam.Hereby, the providing of lines is achieved.

Preferably the method comprises the step:

obtaining image signals from different scanning planes or light emittingplanes when illuminating an object giving rise to parallel lines ordivergent lines in the complete image.

Advantageously, in a second embodiment of the method according to thepresent invention, the method also comprises the steps:

arranging a screen with slits or a raster in front of the light emittingbeam,

obtaining image signals when illuminating an object giving rise to aplurality of lines, or divergent lines, or a plurality of inclininglines in the image. Hereby another way to provide lines is achieved.

Preferably, the method comprises the steps:

arranging a screen with a plurality of through holes arranged in apredetermined pattern in front of the light emitting beam,

obtaining image signals when illuminating an object giving rise to aplurality of dots arranged in the image. Hereby, the provision of dotsis achieved.

Preferably, the method also comprises the steps:

processing the different image signals for distinguishing betweenrelevant and not relevant lines or dots, whereby a relevant line isdefined as a line with a length between 2 cm and 7 cm, and relevant dotsare defined as dots arranged on an imaginary line with a length between2 cm and 7 cm, for providing a complete image of illuminated objects,and

filtering the image signals and eliminate not relevant lines or dots,wherein the complete image is used for comparing the complete image toreference criteria defining different objects. Hereby, better quality inrecognising and determining the position of a part of an animal isachieved.

Advantageously, the method also comprises the step:

grouping together said lines or dots into different groups in dependenceof position in a plane for each line or dot, and the length in saidplane for each line or dots in said plane.

Preferably, the method also comprises the step:

calculating a position for each group, which position is the mean valueof the positions for each line or dot in said group, where each grouprepresents an object. Hereby, the recognising and determining theposition of the part searched for of an animal is achieved with betterquality even if the animal is moving.

Preferably, the method also comprises the step:

moving the light emitting beam or light emitting planes in dependence ofthe movement of said position for a group.

Advantageously, the method also comprises the steps:

selecting from the captured image signals a portion including possiblepart image signals,

processing only the selected portion,

providing in said captured image signals the position of a teat cupentry point for a selected teat, wherein the part is a teat,

quantifying the spatial separation represented by the selected partincluding possible teat image signals and the teat cup entry pointsignal,

providing said guidance information on the basis of the amount of saidseparation, and

providing guidance information for faster movement the greater theseparation. Hereby is achieved that the method according to the presentinvention is working faster.

Preferably, the method comprises the step:

capturing the image by viewing the region with a video camera.

Advantageously, the method also comprises the step:

directing the video camera along a view axis from below and through thestructured light.

Preferably, the number of lines are two.

Advantageously, the method comprises the step:

illuminating said object with a laser emitting beam.

According to another embodiment, the method comprises the step:

illuminating said object with an infrared light beam.

According to a further embodiment, the method comprises the step:

illuminating said object with a lamp, whereby the light from the lamp isdiffracted by a lens/lenses.

According to another embodiment, the method comprises the steps:

illuminating said object with at least two laser emitting beams, wherebyeach laser emitting beam is diffracted by a lens/lenses to a laseremitting plane, and

using the lowermost, in a vertical plane, laser emitting plane todetermine the position of the tip of said part.

The basis of the present invention is to “virtually paint” differentobjects with the aid of e.g. laser beams, so that the objects areilluminated at one or several moments, giving several e.g. horizontallaser-lines on the objects. With this technique it is easy to identifythe outlines of different objects. These identified outlines of anobject and reference criteria defining e.g. a teat are used to determineif the illuminated object is a teat. Then the position of an establishedteat is determined.

Embodiments of the invention will now be described with a reference tothe accompanying drawings, in which:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a schematic diagram of an apparatus to form ateat-distinguishing image,

FIG. 2 shows a schematic diagram of a first way of performing scanningmovement,

FIG. 3 shows a schematic diagram of a second way of performing scanningmovement,

FIG. 4 shows a block diagram of image processing hardware,

FIGS. 5a, b, c show different animal related devices used in connectionwith the apparatus according to the present invention,

FIG. 6a, is a first example of the images captured by the camera,

FIG. 6b, is an example of the images captured by the camera, where thenumber of lines are 2,

FIG. 7 is a second example of the images captured by the camera,

FIG. 8a, is a third example of the images captured by the camera,

FIG. 8b, is an example of the images captured by the camera, where thenumber of lines are 2,

FIG. 9 is a flow chart of the method according to the present invention.

FIG. 10 shows a diagrammatic picture of the movement of the robot armwith the carrier,

FIG. 11 shows a diagrammatic picture of the relation between theilluminated objects and the image captured by the camera, and

FIG. 12 is a diagram showing the positions of the identified teats of acow.

FIG. 13 shows a perspective view of a part of a second embodiment of anapparatus to form a teat-distinguishing image;

FIG. 14 shows a side view of the in FIG. 13 disclosed apparatus;

FIG. 15 shows a diagrammatic picture of the relation between theilluminated object and the mouth of a teat cup;

FIG. 16 shows a diagrammatic picture of the relation between theilluminated object and the mouth of a teat cup when the object isinclining; and

FIG. 17 shows a diagrammatic picture of the relation between theilluminated object and the mouth of a teat cup when using the apparatusdisclosed in FIGS. 13 and 14.

DETAILED DESCRIPTION OF EMBODIMENTS

FIG. 1 shows a schematic diagram of an apparatus to form ateat-distinguishing image. The apparatus comprises a source 10 ofstructured light 12, in this example a small laser 10 such as a 5milliwatt device from the firm Vector Technology, England, fitted with alens 11 to provide a light sheet 12 of an included angle of some 60° to80° with uniform illumination. Such a laser is a tube about 12millimeters in diameter and 75 millimeters long with a fairly thinconnection cable so it is not a severe additional load for ateatcup-carrier robot arm 13, even when mounted at the outer end of therobot arm 13. The laser 10 is positioned to direct the sheet of light 12a small distance above the mouth 14 of a teat-cup 15 when in the carrier16 of the robot arm 13. The carrier 16 of the robot arm 13 can alsocarry other different animal related devices, se e.g. FIGS. 5a, b and c.

An image capture means 17, e.g. a compact solid state camera 17 is alsomounted on the animal-related-device-carrier 16. This camera 17 is a ½inch (12 mm) charge coupled device camera (CCD-camera) fitted with alens 18 to give a 100° angle of viewing 19 in the vertical plane. Thecamera 17 is positioned at an angle to the light sheet 12 so that oneextreme of the angle of view is on or below e.g. the mouth 14 of theteat cup 15, and therefore below the light sheet 12, while the otherextreme is directed to the rear of a perpendicular to the plane of thelight sheet 12. This positioning of the camera view angle assists indistinguishing between objects at different distances from the camera17.

The apparatus also comprises a support means by means of which the lightsheet 12 (in the form of a laser emitting beam) performs a scanningmovement in a substantially horizontal plane. According to anotherembodiment of the apparatus of the present invention, the apparatus alsocomprises a support means by means of which the light sheet 12 (in theform of a laser emitting beam) performs a scanning movement in asubstantially vertical plane. FIGS. 2 and 3 shows different ways ofperforming a scanning movement. In FIG. 2 there is disclosed thesituation where the structured light 12 is in the form of a line orlines and wherein the scanning movement is performed by raising andlowering the robot arm 13 and consequently the source 10 of structuredlight 12, e.g. a laser emitting device. In FIG. 3 there is disclosed thesituation where the structured light 12 is in the form of a dot shapedbeam. The scanning movement is performed in two steps. First of all thelaser emitting device 10 is turned around an axis A, which gives rise toa line, if the turning of the laser emitting device 10 is performed fastenough. Secondly, this line is made to perform a scanning movement byraising and lowering the robot arm 13 and consequently the laseremitting device 10.

In FIG. 1 there is also, with a dotted line, disclosed a screen 6 or araster 6 arranged in front of the laser emitting device 10. The screen 6can be provided with slits or a plurality of through holes (see FIGS. 6and 7).

A connection to energise the laser 10 is indicated at 20, signal andenergisation connections for the camera 17 at 21 and the vacuum line forthe teat-cup 15 at 22. The robot arm 13 can be of the type shown inGB-PS 2,226,941 or GB-PS 2,258,382 or other suitable type. The controlinstructions for the robot arm are derived from the video camerainformation.

FIG. 4 shows a block diagram of units of an image capture and processingarrangement. In FIG. 4 a laser stripe generator is indicated at 31 and acamera to view an image produced by the laser stripe is indicated at 32.Both are on the robot arm, part of which is shown at 36. A power supplyunit 33 energises electronic circuit units 34 and 35 and camera 32, ifneeded. Unit 35 processes the image information from camera 32 andsupplies image position information to unit 34 which provides controlinformation to output 37 for the robot (not fully shown). Power andsignal cables are held together 38 on the robot arm.

In FIG. 4 there is also disclosed a control means 39 arranged todetermine if the illuminated object is e.g. a teat by the use ofreference criteria defining e.g. a teat, wherein the image of theilluminated object is compared to reference criteria defining differentparts of said animal.

FIGS. 5a, b and c show different animal related devices used inconnection with the apparatus according to the present invention. FIG.5a shows a video camera 40 which can be used for inspecting injuries onthe udder and/or the teats. FIG. 5b shows a spray device 42 for sprayingof the udder and the teats, e.g. for cleaning of these. FIG. 5c shows acup 44, which to a suitable level is filled with iodine in which theteats are dipped after finished milking.

The apparatus for recognising and determining the position of a part ofan animal according to the present invention can also comprise a memorydevice (not shown) for storing different image signals. The memorydevice can e.g. be included in the image signal processing unit 35,which process the different image signals to distinguish betweenrelevant and not relevant lines or dots, whereby a relevant line isdefined as a line with a length between 2 cm and 7 cm, and relevant dotsare defined as dots arranged on an imaginary line with a length between2 cm and 7 cm to provide a complete image of illuminated objects. Theapparatus further comprises a filtering means (not shown) to filter theimage signals and eliminate not relevant lines or dots. The filteringmeans can e.g. also be included in the image signal processing unit 35connected to and situated before the memory device. The apparatus canalso be provided with pivotal means, by means of which the laseremitting beam performs a scanning movement in a substantially horizontalplane or a substantially vertical plane. The pivotal means can e.g. beconstituted by a bidirectionally controllable stepper motor. Theapparatus can also comprise a means for during scanning moving thescanning plane upwardly from a position below the teat to a positionwherein the position of the teat can be determined. The scanning planeis moved step-wise in such a way that a distance between two consecutivescanning planes is greater than the width of the laser emitting beam.

FIG. 6a is a first example of the images captured by the camera 17; 32.FIG. 6a shows an example wherein the illuminated object is a teat 50.FIG. 6 shows the complete image after processing in the image signalprocessing means 35. In this case the apparatus according to the presentinvention comprises the pivotal means and the means for moving thescanning plane so that the laser emitting beam performs a scanningmovement in a substantially horizontal plane. In the first scanningplane the laser emitting device 10; 31 illuminates the teat 50 with afirst line 52 ₁. The image signal of this line 52 ₁ is captured by thecamera 17: 32 and stored in the memory device. Then the scanning planeis moved upwardly and the laser emitting device 10; 31 illuminates theteat 50 with a second line 52 ₂. The image signal of this second line 52₂ is also captured by the camera 17; 32 and stored in the memory device.This process continues until the object can be identified, e.g. as ateat. In this case the teat 50 is illuminated with n lines, where n≧2.The image signals of the different lines 52 ₁, . . .52 _(n) are storedin the memory device and “buffered” in the image signal processing means35 to a complete image. The different image signals also comprises notrelevant lines 54 ₁, . . . 54 _(n) due to e.g. disturbances. These notrelevant lines 54 ₁, . . . 54 _(n) are eliminated by the filtering meansso they are actually eliminated in the complete image. They are onlyshowed in FIG. 4 to explain the process. In the complete image thedifferent lines 52 ₁, . . . 52 _(n) are separated by not illuminatedareas 56 ₁, . . . 56 _(n−1). The complete image will have a distinctcontrast and the different objects can easily be identified by thecontrol means 39, which uses reference criteria defining e.g. a teat todetermine if the object is a teat. Then the image signal processingmeans 35 determines the position of the established teat.

In FIG. 6a, the teat 50 is illuminated with n lines, in this case atleast 6 lines. However, experiments have proved that a sufficientresult, i.e. the object can be identified, e.g. as a teat, can beachieved with only 2 lines. This situation and preferred embodiment isdisclosed in FIG. 6b.

The complete image of FIG. 6a, or 6 b can also be accomplished with anapparatus comprising a screen 6 with slits or a raster 6 arranged infront of the laser emitting device instead of the pivotal means. Inthese cases the laser emitting beam is not performing a scanningmovement.

The lines 52 ₁, . . . 52 _(n) disclosed in FIGS. 6a, or 6 b can also bedivergent lines (not showed). This can be accomplished both with ascreen with slits or a raster or with a pivotal means.

FIG. 7 is a second example of the images captured by the camera 17; 32.FIG. 7 shows an example wherein the illuminated object is a teat 60.FIG. 7 shows the complete image after processing in the image signalprocessing means 35. In this case the apparatus according to the presentinvention comprises a screen with a plurality of through holes arrangedin a predetermined pattern, arranged in front of the laser emittingdevice 10; 31. When the teat 60 is illuminated with the laser emittingbeam 12 it gives rise to a plurality of dots 62 ₁, . . . 62 _(n)arranged in the image.

The rest of the process is similar to the one described in connectionwith FIGS. 6a, and 6 b.

FIG. 8a is a third example of the images captured by the camera 17; 32.FIG. 8a shows an example wherein the illuminated object is the rump 51of a cow. FIG. 8a shows the complete image after processing in the imageprocessing means 35. In this case the rump 51 of the cow is illuminatedwith n lines, where n≧2. The image signals of the different lines 52 ₁,. . . , 52 _(n) are stored in the memory device and “buffered” in theimage signal processing means 35 to a complete image. In this case thereference criteria are longer lines than in the case in accordance withFIGS. 6a, and 6 b. The rest of the process is similar to the onedescribed in connection with FIGS. 6a and 6 b.

In FIG. 8b, there is disclosed the preferred embodiment where the numberof lines are 2. Experiments have proved that a sufficient result can beachieved with only 2 lines, i.e. the object can be identified as a rump51.

FIG. 9 is a flow chart of the method according to the present invention.The method begins at block 70. At block 72 the method continues withilluminating with structured light a region expected to contain at leastone teat in such a way that an object illuminated by said lightsimultaneously or discrete in time is partitioned into at least twoilluminated areas, where each two illuminated areas are separated by anot illuminated area. The expression area in the context when using alaser is hereby used to mean a well defined zone, with very distinctoutlines. Dots and lines provided by a laser are quite distinct and welldefined. The method continues at block 74 with capturing at least oneimage formed by said light and provide an image signal. The next step,at block 76, consists of processing said image signals to determine ifthe illuminated object is said part by the use of reference criteriadefining e.g. a teat, wherein the image of the illuminated object iscompared, by the control means 39, to reference criteria definingdifferent objects and if said illuminated object is a part of theanimal, the position thereof is established. The reference criteria canbe stored in the image signal processing device 35. The method continuesat block 78 with determining the position of an established part. Thenext step, at block 80, consists of providing information for guiding ananimal related device towards the determined position of said part. Themethod is completed at block 82.

FIG. 10 shows a diagrammatic picture of the movement of the robot armwith the carrier. In FIG. 10 there is disclosed four teats 90, 92, 94,96 of a cow. The robot arm 13 (see FIG. 1) with the carrier 16, andconsequently the laser emitting device 10 and the camera 17 are movingin a substantially zigzag pattern 98, in a direction from right to leftin the picture, as indicated with the arrow C. At the same time as therobot arm 13 performs this zigzag movement, the laser emitting device 10performs e.g. the scanning movement.

FIG. 11 shows a diagrammatic picture of the relation between theilluminated objects and the image captured by the camera. 100 indicatesthe camera and the laser emitting device. In this case the laseremitting device 100 illuminates two teats A, B. The light is reflectedback from the teats A, B to the camera 100, which is able to measure thepositions of the lines A′, B′, (the right part of FIG. 11) and also thewidths of the lines A′, B′. As is apparent in FIG. 11 the line A′ issituated above the line B′ in the image 102 captured by the camera 100.This means that the teat A is nearer the camera 100 than the teat B.When the camera 100 captures an image, the image will contain a numberof lines. Each line will have an x-, y-position and a length d. Allthese lines are grouped together, by means of the control means, intodifferent groups in dependence of the position in a plane for each line,and the length in said plane for each line in said plane. A line whichis close to an existing group is added to that group and the newposition of the group is moved to a mean value position for the positionof the added line and the old position of the group. The control meansperforms this calculation of the mean value position for each group,where each group represents an object. This calculation of a mean valueposition for each group means that the position for each group will bemoving if e.g. the cow is moving. Each group has a range of tolerance independence of the searched part. All lines which are within this rangeof tolerance will be added to that group, while lines outside this rangeof tolerance will define a new group. If a line can belong to severalgroups, the line is added to the nearest group.

FIG. 12 is a diagram showing the positions of the identified teats of acow. In this diagram there is disclosed four different groups 104, 106,108, 110 containing different number of lines. In this case each grouprepresents a teat.

FIG. 13 shows a perspective view of a part of a second embodiment of anapparatus to form a teat-distinguishing image. The apparatus comprises asource 10 of structured light, in this example two small lasers 10 ₁, 10₂, each fitted with a lens/lenses to provide a light sheet or lightplane (not shown) of an included angle of some 60° to 80° with uniformillumination. The apparatus also comprises a robot arm 13 for carryingthe source 10 of structured light and a carrier 16 of the robot arm 13to carry the teat cup 15 with the mouth 14 thereof. An image capturemeans 17, e.g. a compact solid state camera 17 is also mounted on thecarrier 16, in this case in the same housing as the two lasers 10 ₁, 10₂. The two lasers 10 ₁, 10 ₂ are directing the light planes in slightlydifferent directions (see FIG. 14).

In FIG. 14 there is disclosed a side view of the in FIG. 13 disclosedapparatus. In this figure it is apparent that the first laser 10 ₁provides a first light plane 12 ₁ and the second laser 10 ₂ provides asecond light plane 12 ₂. In a vertical plane these two light planes 12₁, 12 ₂ are separated by an angle α. The second laser 10 ₂ is positionedin such a way that the second light plane 12 ₂ passes a small distance dabove the mouth 14 of the teat cup 15. The values of α and d aredetermined by the geometry of the apparatus. One example of α is 8° andone example of d is 8.5 mm. This embodiment with this second light plane12 ₂ makes the positioning of the mouth 14 on the teat even faster andsafer. It shall be pointed out that this embodiment is not limited toonly two lasers. The apparatus can comprise N lasers, where N≧2, as longas the lowermost, in a vertical plane, light plane 12 _(n) is positionedto pass a small distance d above the centre of the mouth 14. It is notnecessary that each laser is provided with lens/lenses. 12 ₁, 12 ₂discloses in this case laser beams and the apparatus comprises a supportmeans by means of which the laser beams perform a scanning movement in asubstantially horizontal plane. A further explanation will be givenbelow in connection with FIGS. 15-17.

FIG. 15 shows a diagrammatic picture of the relation between theilluminated object and the mouth of a teat cup. In the leftmostsituation the teat 50 is only illuminated by the first light plane 12 ₁,giving rise to a line 50 ₁. The apparatus has guided the mouth 14 of theteat cup to the disclosed position. This is described in connection withFIGS. 1-12 and will not be described again. In the rightmost situationthe source 10 (see FIGS. 13 and 14) has moved upwards and the teat 50 isalso illuminated by the second light plane 12 ₂ giving rise to line 50₂. This second line 50 ₂ makes it easier to determine the exact positionof the tip of the teat 50.

FIG. 16 shows a diagrammatic picture of the relation between theilluminated object and the mouth of a teat cup when the object isinclining. As is apparent from this figure the teat 50 is inclining verymuch. If the teat 50 is only illuminated by the first light plane 12 ₁giving rise to a line 50 ₁ the situation can be as in the leftmostposition of the mouth 14 where it is guided away from the tip of theteat 50. If on the other hand the teat 50 is also illuminated by thesecond light plane 12 ₂ giving rise to a second line 50 ₂ the mouth 14will be guided towards the tip of the teat 50, as is apparent in therightmost position of the mouth.

FIG. 17 shows a diagrammatic picture of the relation between theilluminated object and the mouth of a teat cup when using the apparatusdisclosed in FIGS. 13 and 14. In this figure the first light plane 12 ₁has moved upwards and gives rise to a first line 50 ₁ positioned on theudder instead of on the teat 50. The first line 50 ₁ has moved away fromthe tip of the teat 50. Due to the second line 50 ₂ positioned on theteat 50 the mouth 14 will be guided and positioned as disclosed in thefigure.

The structured light mentioned in the description has so far only beendisclosed as laser light in the figures. The structured light can alsobe in the form of infrared light or manipulated light which has acertain shape, e.g. a line or dots. The manipulation can be comprised ofthat light will pass a combination of e.g. lenses and screens.

The invention is not limited to the embodiment described in theforegoing. It will be obvious that many different modifications arepossible within the scope of the following claims. Furthermore, itshould be noted that even though the described apparatus and method donot require the use of historical data of the animal, such use is notexcluded, as it may enhance the performance of said apparatus andmethod.

What is claimed is:
 1. An apparatus for recognising and determining theposition of at least one part of an animal, wherein the apparatuscomprises a source (10; 31) of structured light (12) for illuminating aregion expected to contain said at least one part wherein an objectilluminated by said light (12) simultaneously or discrete in time ispartitioned into at least two illuminated areas (52 ₁, 52 ₂, 62 ₁, 62 ₂)where each two illuminated areas (52 ₁, 52 ₂, 62 ₁, 62 ₂) are separatedby a not illuminated area (56 ₁), an image capture means (17; 32)arranged to capture at least one image and provide an image signal, theapparatus further comprising an image signal processing means (35) torespond to said captured image signal and a control means (39) todetermine if the illuminated object is said part by comparing the imageof the illuminated object to reference criteria defining differentobjects, and if said illuminated object is established to be said partof the animal, the position thereof is established, an animal relateddevice (15; 40; 42; 44) and means to guide the animal related device(15; 40; 42; 44) towards the determined position of said part.
 2. Theapparatus defined by claim 1, wherein said at least one image capturedby said image capture means (17; 32) is formed by said light (12). 3.The apparatus defined by claim 2, wherein the source (10; 31) ofstructured light (12) is a light emitting device (10; 31), and whereineach area of said at least two illuminated areas (52 ₁, 52 ₂, 62 ₁, 62₂) is in the form of a line or a dot and the number of lines or dots issuch that the control means is allowed to identify the illuminatedobject.
 4. The apparatus defined by claim 3, wherein the apparatus alsocomprises a screen (6) with slits or a raster arranged in front of thelight emitting device (10; 31).
 5. The apparatus defined by claim 4,wherein the image signals obtained from the screen (6) with slits or theraster (6) when illuminating the object gives rise to plurality of lines(52 ₁, . . . 52 _(n)) in the image.
 6. The apparatus defined by claim 4,wherein the image signals obtained from the screen with slits or theraster (6) when illuminating an object gives rise to divergent lines inthe image.
 7. The apparatus defined by claim 4, wherein the imagesignals obtained from the screen (6) with slits or the raster (6)illuminating an object gives rise to a plurality of inclining lines inthe image.
 8. The apparatus defined by claim 3, wherein the apparatusalso comprises a screen (6) with a plurality of through holes arrangedin a predetermined pattern, arranged in front of the light emittingdevice (10; 31).
 9. The apparatus defined by claim 8, wherein the imagesignals obtained from the screen (6) with through holes arranged in apredetermined pattern, when illuminating an object gives rise to aplurality of dots (62 ₁ . . . , 62 _(n)) arranged in the image.
 10. Theapparatus defined by claim 3, wherein the image signal processing means(35) process the different image signals to distinguish between relevantand not relevant lines or dots, whereby a relevant line is defined as aline with a length between 2 cm and 7 cm, and relevant dots are definedas dots arranged on an imaginary line with a length between 2 cm and 7cm, to provide a complete image of illuminated objects, wherein thecomplete image is used by the control means (39) for comparing thecomplete image to reference criteria defining different objects.
 11. Theapparatus defined by claim 10, wherein the apparatus also comprises afiltering means to filter the image signals and eliminate not relevantlines or dots.
 12. The apparatus defined by claim 3, wherein the numberof lines are two.
 13. The apparatus defined by claim 3, wherein thelight emitting (10; 31) is an infrared emitting device.
 14. Theapparatus defined by claim 3, wherein the light emitting device (10; 31)is a lamp, and wherein the apparatus also comprises a lens/lenses todiffract the light from the lamp.
 15. The apparatus defined by claim 2,wherein said apparatus also comprises a support means provided forscanning movement of at least one light emitting beam.
 16. The apparatusdefined by claim 15, wherein the light emitting beam performs a scanningmovement in a substantially horizontal plane by means of said supportmeans.
 17. The apparatus defined by claim 15, wherein the support meansis moved mainly in a zigzag pattern.
 18. The apparatus defined by claim15, wherein said support means comprises a robot arm (13) and a lightemitting device (10; 31) arranged on the robot arm (13).
 19. Theapparatus defined by claim 15, wherein said support means comprises arobot arm (13), a light emitting device (10; 31) arranged on the robotarm (13), and a pivotal means by means of which the laser emitting beamperforms a scanning movement.
 20. The apparatus defined by claim 2,wherein the light emitting device (10; 31) is a laser emitting device(10; 31).
 21. The apparatus defined by claim 1, wherein the source ofstructured light (12) is at least two light emitting devices, whereineach light emitting device gives rise to a light emitting beam, whereineach two consecutive light emitting beams in a vertical plane areseparated by an angle α, and in that each area of said at least twoilluminated areas (52 ₁, 52 ₂, 62 ₁, 62 ₂) is in the form of a line or adot and the number of lines or dots is such that the control means isallowed to identify the illuminated object.
 22. The apparatus defined byclaim 21, wherein in a vertical plane, the lowermost light emitting beamor light emitting plane is positioned to pass a small distance d abovethe centre of the mouth (14) of a supported teat cup (15).
 23. Theapparatus defined by claim 22, wherein the number of light emittingbeams or light emitting planes are two, and wherein said angle, α, ispreferably 8° and said distance d is preferably 8.5 mm.
 24. Theapparatus defined by claim 23, wherein the light emitting beam performsa scanning movement in a substantially vertical plane by means of saidsupport means.
 25. The apparatus defined by claim 23, wherein the lightemitting beam performs a scanning movement in a substantially incliningplane by means of said support means.
 26. The apparatus defined by claim1, wherein the source of structured light (12) is at least two lightemitting devices, wherein each light emitting device gives rise to alight emitting plane, wherein each two consecutive light emitting planesin a vertical plane are separated by an angle α, and wherein each areaof said at least two illuminated areas (52 ₁, 52 ₂) is in the form of aline and the number of lines is such that the control means is allowedto identify the illuminated object.
 27. The apparatus defined by claim26, wherein the scanning plane(s) or the light emitting planes is/aremoved step-wise in such a way that a distance between two consecutivescanning planes or light emitting planes is greater than the width ofthe light emitting beam.
 28. The apparatus defined by claim 27, whereinthe image signals obtained from different scanning planes whenilluminating an object gives rise to parallel lines (52 ₁, . . . 52 ₂)in the complete image.
 29. The apparatus defined by claim 27, whereinthe image signals obtained from different scanning planes or lightemitting planes when illuminating an object gives rise to divergentlines in the complete image.
 30. The apparatus defined by claim 26,wherein each light emitting device is a laser emitting device, andwherein the apparatus also comprises a lens/lenses to diffract the laseremitting beam from each laser emitting device to a laser emitting plane,wherein the lowermost laser emitting plane is used to determine theposition of the tip of said part.
 31. The method defined by claim 30,comprising illuminating said object with at least two light emittingplanes, wherein each two consecutive light emitting planes in a verticalplane are separated by an angle α, wherein each said at least twoilluminated areas is in the form of a line, and where the number oflines is such that it allows for identifying the illuminated object. 32.The method defined by claim 31, comprising moving the scanning plane(s)or light emitting planes step-wise in such a way that a distance betweentwo consecutive scanning planes or light emitting planes is greater thanthe width of the light emitting beam.
 33. The method defined by claim32, comprising obtaining image signal from different scanning planes orlight emitting planes when illuminating an object giving rise toparallel lines in the complete image.
 34. The method defined by claim32, comprising obtaining image signals from different scanning planes orlight emitting planes when illuminating an object giving rise todivergent lines in the complete image.
 35. The apparatus defined byclaim 1, wherein the control means (39) groups together said lines ordots into different groups in dependence of the position in a plane foreach line or dot, and the length in said plane for each line or dots insaid plane.
 36. The apparatus defined by claim 35, wherein the controlmeans (39) calculates a position for each group, which position is themean value of the positions for each line or dot in said group, whereeach group represents an object.
 37. The apparatus defined by claim 35,wherein when said position for a group is moved, said support means ismoved in correspondence therewith.
 38. The apparatus defined by claim 1,wherein the part is a teat of a milk animal, and wherein the animalrelated device (15; 40; 42; 42) is one of a teat milking cup (15), ateat cleaning device (42) and a teat inspection device (40).
 39. Theapparatus defined by claim 38, wherein the image signal processing means(35) includes means to select from the captured image signals a partincluding possible teat image signals and process only the selectedpart, thereby reducing the time between successive processings of theteat image signals.
 40. The apparatus defined by claim 39, wherein theimage signal processing means (35) provides in said captured imagesignals the position of a teat cup (15) entry point for a selected teat.41. The apparatus defined by claim 1, wherein the part is rump of a milkanimal.
 42. The apparatus defined by claim 1, wherein the source (10;31) of structured light (12) is positioned to pass no lower than themouth (14) of a supported teat cup (15) and the image capture means (17;32) is a video camera (17; 32) arranged to view through the structuredlight (12) and over the mouth (14) of the cup (15).
 43. The apparatusdefined by claim 1, wherein the video camera (16; 32) is a camera of theCCD type (Charged Coupled Device).
 44. The apparatus defined by claim43, wherein the image signal processing means (35) includes means toquantify the spatial separation represented by the selected partincluding possible teat image signals and the teat cup entry pointsignal and provide appropriate control information for said guide means.45. The apparatus defined by claim 44, wherein the control informationcauses more rapid movement of the guide means the greater said spatialseparation.
 46. A method for recognizing and determining the position ofat least one part of an animal, which method comprises the followingsteps: A. illuminating with structured light a region expected tocontain said at least one part in such a way that an object illuminatedby said light simultaneously or discrete in time is partitioned into atleast two illuminated areas, where each two illuminated areas areseparated by a not illuminated area, B. capturing at least one image andprovide an image signal, C. processing said image signals to determineif the illuminated object is said part by comparing the image of theilluminated object to reference criteria defining different objects, andif said illuminated object is established to be said part of the animal,the position thereof is established, and D. providing information forguiding an animal related device towards the determined position of saidpart.
 47. The method defined by claim 46, comprising capturing at leastone image formed by said light.
 48. The method defined by claim 47,comprising illuminating said object with at least one light emittingbeam, wherein each of said at least two illuminated areas is in the formof a line or a dot, and where the number of lines or dots is such thatit allows for identifying the illuminated object.
 49. The method definedby claim 48, comprising moving the light emitting beam to perform amovement mainly in a zigzag pattern.
 50. The method defined by claim 49,comprising pivoting the light emitting beam to perform a scanningmovement in a substantially horizontal plane, and during scanning movingthe scanning plane upwardly from a position below the part to a positionwherein the positions of the part can be determined.
 51. The methoddefined by claim 49, comprising pivoting the light emitting beam toperform a scanning movement in a substantially vertical plane.
 52. Themethod defined by claim 48, comprising arranging a screen with slits ora raster in front of the light emitting beam, obtaining image signalswhen illuminating an object giving rise to a plurality of lines in theimage, or obtaining image signals when illuminating an object givingrise to divergent lines in the image, or obtaining image signals whenilluminating an object giving rise to a plurality of lines, inclininglines in the image.
 53. The method defined by claim 52, comprisingprocessing the different image signals for distinguishing betweenrelevant and not relevant lines or dots, whereby a relevant line isdefined as a line with a length between 2 cm and 7 cm, and relevant dotsare defined as dots arranged on an imaginary line with a length between2 cm and 7 cm, for providing a complete image of illuminated objects,and filtering the image signals and eliminate not relevant lines ordots, wherein the complete image is used for comparing the completeimage to reference criteria defining different objects.
 54. The methoddefined by claim 53, comprising grouping together said lines or dotsinto different groups in dependence of the position in a plane for eachline or dot, and the length in said plane for each line or dots in saidplane.
 55. The method defined by claim 54, comprising calculating aposition for each group, which position is the mean value of thepositions for each line or dot in said group, where each grouprepresents an object.
 56. The method defined by claim 55, comprisingmoving the light emitting beam or light emitting planes in dependence ofthe movement of said position for a group.
 57. The method defined byclaim 48, comprising arranging a screen with a plurality of throughholes arranged in a predetermined pattern in front of the light emittingbeam, obtaining image signals when illuminating an object giving rise toa plurality of dots arranged in the image.
 58. The method defined byclaim 48, wherein the number of lines are two.
 59. The method defined byclaim 48, comprising illuminating said object with a laser emittingbeam.
 60. The method defined by claim 48, comprising illuminating saidobject with an infrared light beam.
 61. The method defined by claim 48,comprising illuminating said object with a lamp, whereby the light fromthe lamp is diffracted by a lens/lenses.
 62. The method defined by claim47, comprising illuminating said object with at least two light emittingbeams, wherein each two consecutive light emitting beams in a verticalplane are separated by an angle α, wherein each of said at least twoilluminated areas is in the form of a line or a dot, and where thenumber of lines or dots is such that it allows for identifying theilluminated object.
 63. The method defined by claim 62, comprisingpassing a small distance d above the centre of the mouth (14) of a teatcup (15) with the lowermost, in a vertical plane, light emitting beam orlight emitting plane.
 64. The method defined by claim 62, wherein thenumber of light emitting beams or light emitting planes are two.
 65. Themethod defined by claim 62, comprising illuminating said object with atleast two laser emitting beams, whereby each laser emitting beam isdiffracted by a lens/lenses to a laser emitting plane, and using thelowermost, in a vertical plane, laser emitting plane to determine theposition of the tip of said part.
 66. The method defined by claim 47,comprising selecting from the captured image signals a portion includingpossible part image signals, and processing only the selected part. 67.The method defined by claim 66, comprising providing in said capturedimage signals the position of a teat cup entry point for a selectedteat, wherein the part is a teat.
 68. The method defined by claim 67,comprising quantifying the spatial separation represented by theselected part including possible teat image signals and the teat cupentry point signal, and providing said guidance information on the basisof the amount of said separation.
 69. The method defined by claim 68,comprising providing guidance information for faster movement thegreater the separation.
 70. The method defined by claim 47, comprisingcapturing the image by viewing the region with a video camera.
 71. Themethod according defined by claim 47, comprising directing the videocamera along a view axis from below and through the structured light.